package com.spzx.product.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.spzx.domain.Brand;
import com.spzx.product.mapper.BrandMapper;
import com.spzx.product.service.IBrandService;
import com.spzx.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * 品牌Service业务层处理
 */
@Service
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements IBrandService {

    @Autowired
    private BrandMapper brandMapper;

    @Override
    public int removeBrandByIds(Long[] ids) {
        return brandMapper.deleteBatchIds(Arrays.asList(ids));
    }

    @Override
    public PageInfo<Brand> pageList(Page<Brand> brandPage, String name) {

        long current = brandPage.getCurrent();
        long size = brandPage.getSize();

        return brandMapper.pageList(current, size, name);
    }
}
